var throttle = function (func, delay) {
    let falg = true;
    return function (e) {
        var context = this;
        if (!falg) return;
        falg = false;
        setTimeout(() => {
            func.apply(context, [e]);
            falg = true;
        }, delay);
    }
}
// 防抖
var debounce1 = function (func, delay) {

    let timeBar = null;
    return function (e) {
        var context = this;
        if (timeBar) clearTimeout(timeBar)
        timeBar = setTimeout(() => {
            func.apply(context, [e]);
        }, delay)
    }
}
function handle(a) {
    console.log(a);
}
window.addEventListener('scroll', throttle(handle, 1000));
// 节流
export default throttle;
// 防抖
export let debounce = debounce1;